<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件高级</title>
</head>

<body>
  <button>按钮</button>
  <!-- 事件委托 -->
  <ul>
    <li>好你小子</li>
    <li>好你小子</li>
    <li>好你小子2</li>
    <li>好你小子2</li>
    <li>好你小子3</li>
  </ul>
  <script>
    var btn = document.querySelector('button')
    btn.addEventListener('click', eventFn)
    function eventFn(e){
      console.log(e)
      console.log(this)
    }
    // 事件委托
    var ul = document.querySelector('ul')
    ul.addEventListener('click',clickFn)
    function clickFn(e){
      console.log(e.target)
      e.target.style.backgroundColor = 'pink'
    }
  </script>
</body>

</html>